define(["jquery","bbcare"],function($,$bb){
	var servers = {};
    var URL = $bb.baseUrl("followapp");

    /**
     * 是否符合手机号码
     */
    servers.isPhoneNo = function(val){
        var reg = /^1[3456789]\d{9}$/;
        return reg.test(val);
    };

	/**
	 * 根据手机号、姓名、科研编号查询患者信息
	 */
	servers.ajaxPatientsByPhoneNo = function(params,callback){
		$bb.ajax({
            url: URL + "ctrl/ptmanage/patientQueryByPhoneNum",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    callback(data.data);
                }else{
                    $bb.toastShow(data.msg ? data.msg : "查询患者出错！");
                }
            }
        });
	}

    /**
     * 保留整数
     */
    servers.exp = function(val){
        var reg = /^\+?[1-9]\d*$/;
        return reg.test(val);
    }

    /**
     * 提交
     */
    servers.ajaxSubmit = function(params,callback){
        $bb.ajax({
            url: URL + "service/evaluation/growthSubmit",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    callback(data.data,params);
                }else{
                    $bb.toastShow(data.msg ? data.msg : "查询患者出错！");
                }
            }
        });
    }

	return servers;
});